package org.litespring.beans.factory.support;

import org.litespring.beans.BeanDefinition;
import org.litespring.beans.ConstructorArgument;
import org.litespring.beans.PropertyValue;

import java.util.ArrayList;
import java.util.List;

public class GenericBeanDefinition implements BeanDefinition {
	private String id;
	private String beanClassName;
	private boolean singleton=true;
	private boolean prototype=false;
	private String getScope = SCOPE_DEFAULT;

	//存放property中的内容
	List<PropertyValue> propertyValues = new ArrayList<PropertyValue>();
	//存放构造函数
	private ConstructorArgument constructorArgument = new ConstructorArgument();

	public GenericBeanDefinition(String id, String beanClassName) {
		this.id = id;
		this.beanClassName = beanClassName;
	}

	public GenericBeanDefinition() {

	}

	public String getBeanClassName() {
		
		return this.beanClassName;
	}

	public boolean isSingleton() {
		return this.singleton;
	}

	public boolean isPrototype() {
		return this.prototype;
	}

	public String getScope() {
		return this.getScope;
	}
	public void setScope(String scope) {
		this.getScope = scope;
		this.singleton=SCOPE_SINGLETON.equals(scope)||SCOPE_DEFAULT.equals(scope);
		this.prototype=SCOPE_PROTOTYPE.equals(scope);
	}

	public List<PropertyValue> getPropertyValues() {
		return this.propertyValues;
	}

	public ConstructorArgument getConstructorArgument() {
		return this.constructorArgument;
	}

	public String getID() {
		return this.id;
	}

	public boolean hasConstructorArgumentValues() {
		return !this.constructorArgument.isEmpty();
	}

	public void setBeanClassName(String className){
		this.beanClassName = className;
	}

	public void setId(String id){
		this.id = id;
	}
}
